<template>
  <div class="app-container">
    <div style="margin-top: 1%">
      <el-descriptions class="margin-top" title="企业信息" :column="3" size="small" border>
        <template slot="extra" v-if="list.user.review==1">
          <el-button type="primary" size="small" @click="handleAudit(list.userId,2)">通过</el-button>
          <el-button type="danger" size="small" @click="handleAudit(list.userId,3)">驳回</el-button>
        </template>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.companyName }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.companyCode }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.province }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.city }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.county }}
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.address }}
        </el-descriptions-item>


        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.contact }} {{ list.contactTel }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            园区
          </template>
          {{ list.personName }} {{ list.personUrl }}
        </el-descriptions-item>


      </el-descriptions>
    </div>
  </div>
</template>

<script>
  import { getCompanyById, findApprovedById } from "@/api/company";

  import VueQr from "vue-qr";
  export default {
    data() {
      return {
        list: null,
        listLoading: true,
        isShowPayPopup: false,
        bgSrc: "",
        logoSrc: require("@/assets/images/logo.png"),
        codeUrl: "weixin://wxpay/bizpayurl?pr=TEoxYn0zz",
        countDownSecond: 1,
        tableData: [],
        prc_list: [],
        lid: null,
      };
    },
    components: {
      VueQr,
    },
    created() {
      console.log(this.$route.query);
      this.fetchData(this.$route.query.id);
      this.lid = this.$route.query.id;
      this.prc.leaseId = this.lid;
    },
    methods: {
      fetchData(obj) {
        this.listLoading = true;
        getCompanyById(obj).then((response) => {
          this.listLoading = false;
          console.log(response);
          this.list = response.data;
          console.log(this.list);
        });
      },
      setCurrent() {
        this.$refs.table.setCurrentRow(this.tableData[1]);
      },
      refreshCodeTap() { },

      handleAudit(id, obj) {
        this.listLoading = true;
        findApprovedById(id, obj)
          .then((response) => {
            console.log(response);
            this.listLoading = false;
            this.$message.success(response.message);
            this.fetchData(this.lid);
          })
          .catch((error) => {
            console.log(error);
            this.listLoading = false;
          });
      },
    },
  };
</script>
<style scoped>
  .el-descriptions__header {
    margin-bottom: 0px;
  }
</style>